package com.imooc.api.controller.article;

import com.imooc.grace.result.GraceJSONResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

/**
 * 门户端文章业务
 */
@RequestMapping("portal/article")
public interface ArticlePortalControllerApi {

    /**
     * 首页查询文章列表（后续的搜索接口）
     *
     * @param keyword  搜索关键字
     * @param category 文章分类
     */
    @GetMapping("list")
    GraceJSONResult list(@RequestParam String keyword, @RequestParam Integer category, @RequestParam Integer page, @RequestParam Integer pageSize);

    /**
     * 首页查询热闻列表
     */
    @GetMapping("hotList")
    GraceJSONResult hotList();

    /**
     * 查询作家发布的所有文章列表
     */
    @GetMapping("queryArticleListOfWriter")
    GraceJSONResult queryArticleListOfWriter(@RequestParam String writerId, @RequestParam Integer page, @RequestParam Integer pageSize);

    /**
     * 作家页面查询近期佳文
     */
    @GetMapping("queryGoodArticleListOfWriter")
    GraceJSONResult queryGoodArticleListOfWriter(@RequestParam String writerId);

    /**
     * 文章详情查询
     */
    @GetMapping("detail")
    GraceJSONResult detail(@RequestParam String articleId);

    /**
     * 阅读文章，文章阅读量累加
     */
    @PostMapping("readArticle")
    GraceJSONResult readArticle(@RequestParam String articleId, HttpServletRequest request);

}
